unit Main;

interface

uses
    Winapi.Windows,Winapi.Messages,
    System.SysUtils,System.Variants,System.Classes,
    VCL.Graphics,
    Vcl.Controls,
    Vcl.Forms,
    Vcl.Dialogs,
    Vcl.ImgList,
    Vcl.Imaging.pngimage,
    Vcl.ExtCtrls,Vcl.ExtDlgs,
    Vcl.ToolWin,
    Vcl.ComCtrls,
    Vcl.Menus,
    Vcl.StdCtrls,

    jpeg,
    math,
    OpenGL,
    Stroke,
    Point,
    Files,
    GLCrossPlatform,
    BaseClasses,
    Oeuvre;

type
    TMainForm = class(TForm)
        OpenPictureDialog1: TOpenPictureDialog;
        Button1: TButton;
    Button2: TButton;
    SavePictureDialog1: TSavePictureDialog;
    procedure FormClick(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    public
    published
        procedure FormCreate(Sender: TObject);
    private

    end;
var
    MainForm : TMainForm;
    tic : integer;
    monOeuvre : TOeuvre;

implementation

{$R *.dfm}

procedure TMainForm.Button2Click(Sender: TObject);
    var
            bm : TBitmap;
    begin
            bm:=monOeuvre.GetBitmapFromRender() ;

            try
                SavePictureDialog1.DefaultExt := GraphicExtension(TBitmap);
                SavePictureDialog1.Filter := GraphicFilter(TBitmap);
                if SavePictureDialog1.Execute then
                bm.SaveToFile(SavePictureDialog1.FileName);
            finally
                bm.Free;
            end;
     end;

procedure TMainForm.FormClick(Sender: TObject);
begin
        self.Close;
end;

procedure TMainForm.FormCreate(Sender: TObject);
    var
        myFile : string;
    begin
        //myfile := OpenMyFile(self);
        myfile :='c:\$tfe\images\1.jpg';
        monOeuvre := TOeuvre.Create(self);
        monOeuvre.photoPath := myFile;
        monOeuvre.Show;
    end;
end.
